import useRequest from "@/api/useRequest";
import {IPage} from "@/interface/modules/system";

export class mediaController {

    static listMediaInfo(data: any): Promise<any> {
        return useRequest({
            url: "/lux/link",
            method: "post",
            data
        })
    }

    static listDouyin(data:any):Promise<any>{
        return useRequest({
            url: "/lux/listByDouyin",
            method: "post",
            data
        })
    }
    static listMediaList(data:any ,pagination?: IPage): Promise<any>{
        return useRequest({
            url: "/lux/list",
            method: "post",
            params: pagination,
            data
        })
    }

    static addMediaFromVoice(data:any):Promise<any>{
        return useRequest({
            url: "/lux/addMediaInfoFromVoice",
            method: "post",
            data
        })
    }

    static isFfmpegOk(): Promise<any>{
        return useRequest({
            url: "/lux/isFfmpegOk",
            method: "get"
        })
    }

    static mediaDownload(data:any): Promise<any>{
        return useRequest({
            url: "/lux/download",
            method: "post",
            data
        })
    }

    static submitDownloadTask(data:any): Promise<any>{
      return useRequest({
        url: "/lux/download",
        method: "post",
        data
      })
    }

    static mediaDelete(mediaId:string): Promise<any>{
        return useRequest({
            url: "/lux/delete?mediaId="+mediaId,
            method: "get",
        })
    }


    static addMediaInfo(data:any): Promise<any>{
        return useRequest({
            url: "/lux/addMediaInfo",
            method: "post",
            data
        })
    }

    static deleteTextRecord(userFileId:any): Promise<any>{
        return useRequest({
            url: "/lux/deleteTextRecord?userFileId="+userFileId,
            method: "get",
        })
    }

  static importSRT(data:any): Promise<any>{
    return useRequest({
      url: "/lux/importVideoText",
      method: "post",
      data
    })
  }

  static importSRTByFileId(data:any): Promise<any>{
    return useRequest({
      url: "/lux/importVideoTextByFileId",
      method: "post",
      data
    })
  }


  static refresh():Promise<any>{
    return useRequest({
      url: "/lux/refresh",
      method: "get"
    })
  }


  static getLog(taskId:string):Promise<any>{
    return useRequest({
      url: "/lux/getWhisperLog?taskId="+taskId,
      method: "get",
      timeout: 3000
    })
  }

  static killWhisperTask(taskId:string):Promise<any>{
    return useRequest({
      url: "/lux/killWhisperTask?taskId="+taskId,
      method: "get"
    })
  }
}
